﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ENTITY;
using System.Data.SqlClient;
using System.Data;

namespace MODELS
{
     public class MOD_Muc
    {
         private dbConnect dbConn;
         public MOD_Muc()
         {
             dbConn = new dbConnect();
         }
         public DataTable select_STR(string strSQL)
         {
             return dbConn.GetData(strSQL);
         }
         public DataTable Muc_SelectALL()
         {
             return dbConn.GetData("Muc_SELECTALL", null);
         }

         //
         public int Insert(EN_Muc obj_En)
         {
             SqlParameter[] para = { 
                                   
                                    new SqlParameter("MaBai",obj_En.MaBai),
                                     new SqlParameter("MaMuc",obj_En.MaMuc),
                                    new SqlParameter("TenMuc",obj_En.TenMuc),
                                    new SqlParameter("NoiDung",obj_En.NoiDug),
                                    new SqlParameter("Video",obj_En.Video)
                                  };
             return dbConn.ExecuteSQL("Muc_Insert", para);
         }

         public int Update(EN_Muc obj_En)
         {
             SqlParameter[] para = {
                                    new SqlParameter("MaBai",obj_En.MaBai),
                                     new SqlParameter("MaMuc",obj_En.MaMuc),
                                    new SqlParameter("TenMuc",obj_En.TenMuc),
                                    new SqlParameter("NoiDung",obj_En.NoiDug),
                                    new SqlParameter("Video",obj_En.Video)
                                  };
             return dbConn.ExecuteSQL("Muc_Update", para);
         }

         public int Delete(EN_Muc obj_En)
         {
             SqlParameter[] para = { 
                                    new SqlParameter("MaMuc", obj_En.MaMuc)
                                  };
             return dbConn.ExecuteSQL("Muc_Delete", para);
         }

    }
}
